<!--suppress ALL -->
<div class="layui-fluid layui-anim website-anim" id="website-appraisal-result" lay-title="评审结果"
     xmlns:th="http://www.w3.org/1999/xhtml">
    <div class="layui-row website-container">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body website-table-full">
                    <div class="layui-inline">
<!--                        <label id="resultTable-text" class="layui-form-label" th:text="'总分: '+ ${score==null?'-':score}"></label>-->
                        <div id="resultTable-text"></div>
                    </div>
                    <table lay-filter="resultTable" lay-data="{id: 'resultTable'}"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script data-th-inline="javascript" type="text/javascript">
    layui.use(['jquery', 'table', 'website'], function () {
        let $ = layui.jquery,
            website = layui.website,
            form = layui.form,
            table = layui.table,
            $view = $('#website-appraisal-result'),
            declareTopicId = [[${declareTopicId}]],
            planId = [[${planId}]],
            tableIns;

        let column = [
            {type: 'numbers', title: '序号',},
            {
                title: '指标', minWidth: 100, templet: function (d) {
                    let text = d.indicatorName;
                    if (d.indicatorDescription) {
                        text += "-" + d.indicatorDescription
                    }
                    return text;
                }
            },
            {field: 'weight', title: '权重', minWidth: 100},

        ];
        getColumn();
        getScore();
        function getScore() {
            website.get(ctx + 'client/getAppraisalResultScore/' + declareTopicId, null, function (data) {
                if (data.code === 200) {
                    $('#resultTable-text').append(' &nbsp;&nbsp;&nbsp;&nbsp;<span style="float: right"> 总得分：' + data.data + '</span>')
                }
            });
        }
        //获取列
        function getColumn() {
            website.get(ctx + 'biz/evaluation/review/client/column/' + declareTopicId + "/" + planId, null, function (data) {
                for (expert of data.data) {
                    let item = {};
                    item.field = expert.expertId
                    item.title = expert.name
                    column.push(item);
                }
                initTable();
            });
        }

        /**
         * 初始化表格
         */
        function initTable() {
            tableIns = website.table.init({
                elem: $view.find('table'),
                id: 'resultTable',
                limit: Number.MAX_VALUE,// 数据表格默认全部显示
                page: false,
                url: ctx + 'biz/evaluation/review/' + declareTopicId + "/" + planId,
                cols: [column],
            });
        }

    })
</script>